package book;

/**
 * 书架
 */
public class BookList {
    //封装books和usedSize
    private Book[] books = new Book[10];
    private int usedSize;

    //构造方法，new书架bookList的时候，books中默认放入三本书
    public BookList() {
        books[0] = new Book("水浒传","施耐庵",59,"小说");
        books[1] = new Book("西游记","吴承恩",38,"小说");
        books[2] = new Book("三国演义","罗贯中",89,"小说");
        this.usedSize = 3; //书的有效个数初始值

    };

    //用Add调用setPosBook是尾插法，Modify调用是是修改该位置
    public void setPosBooks(int pos, Book book) {
        this.books[pos] = book;
    }

    public Book getPosBooks(int pos) {
        return this.books[pos];
    }

    public int getUsedSize() {
        return usedSize;
    }

    public void setUsedSize(int usedSize) {
        this.usedSize = usedSize;
    }
}





//可以在这里，在BookList类中写增删查改等方法，来实现对Book[]类型的books操作